package com.njtoyo.taxi.admin.rest.controller.data;

import com.njtoyo.taxi.admin.aop.PermissionScope;
import com.njtoyo.taxi.admin.rest.wrapper.data.rank.TodayRankWrapper;
import com.njtoyo.taxi.admin.service.data.TodayRankService;
import com.taxi.entity.common.RestResult;
import com.njtoyo.taxi.entity.backend.AdminUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

@RequestMapping("/data/data_analysis/rank")
@Api(value = "排名数据", tags = "排名数据")
@RestController
public class TodayRankController {

    @Autowired
    private TodayRankService todayRankService;

    @GetMapping("/order")
    @ApiOperation(value = "订单排名", notes = "权限：data_analysis_today_order")
    @PermissionScope(names = {"data_analysis_today_order"})
    public RestResult order(@ApiIgnore @ModelAttribute("admin") AdminUser adminUser, TodayRankWrapper wrapper) {
        return todayRankService.order(adminUser, wrapper);
    }

    @GetMapping("/income")
    @ApiOperation(value = "收入排名", notes = "权限：data_analysis_today_income")
    @PermissionScope(names = {"data_analysis_today_income"})
    public RestResult income(@ApiIgnore @ModelAttribute("admin") AdminUser adminUser, TodayRankWrapper wrapper) {
        return todayRankService.income(adminUser, wrapper);
    }

    @GetMapping("/call")
    @ApiOperation(value = "呼叫排名", notes = "权限：data_analysis_today_order")
    @PermissionScope(names = {"data_analysis_today_order"})
    public RestResult call(@ApiIgnore @ModelAttribute("admin") AdminUser adminUser, TodayRankWrapper wrapper) {
        return todayRankService.call(adminUser, wrapper);
    }

    @GetMapping("/customer")
    @ApiOperation(value = "乘客排名", notes = "权限：data_analysis_today_customer")
    @PermissionScope(names = {"data_analysis_today_customer"})
    public RestResult customer(@ApiIgnore @ModelAttribute("admin") AdminUser adminUser, TodayRankWrapper wrapper) {
        return todayRankService.customer(adminUser, wrapper);
    }
}
